using System;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;

class screenshot
{
     void take()
     {
          // Create the path
          string path = Path.Combine(Directory.GetCurrentDirectory(), "ss.bmp");
              
          try
          {
               // Create a new bitmap class with the height and width of the screen
               Bitmap bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format32bppArgb);
               // Create new Graphics class..
               Graphics gfxScreenshot = Graphics.FromImage(bmpScreenshot);
               // Copy the screen image to the Graphics class
               gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
               // Save it to a path
               bmpScreenshot.Save(path, ImageFormat.Bmp);
          }
          catch { } // "should" never be hit :P
     }
}